package View;

import javax.swing.*;

import java.awt.Color;
import java.awt.GridLayout;

import Controller.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;


public class SistemadeBackup extends JPanel{

	JPanel SistemaBackup;
	
	public SistemadeBackup() {
		setLayout(new GridLayout(0, 1, 0, 0));
		SistemaBackup = new JPanel();
		
		SistemaBackup.setBackground(null);
		add(SistemaBackup);
		
		
		
		JButton btnNewButton = new JButton("Backup");
		btnNewButton.setBackground(new Color(255, 255, 255));
		btnNewButton.setForeground(new Color(0, 175, 239));

		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				MySQLBackup b = new MySQLBackup();
				
			}
		});
		
		
		JButton btnRestaurar = new JButton("Restaurar");
		btnRestaurar.setBackground(new Color(255, 255, 255));
		btnRestaurar.setForeground(new Color(0, 175, 239));

		btnRestaurar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				RestauraBackup a= new 	RestauraBackup();			
			}
		});
		
		JSeparator separator = new JSeparator();
		
		JScrollPane scrollPane = new JScrollPane();
		GroupLayout gl_SistemaBackup = new GroupLayout(SistemaBackup);
		gl_SistemaBackup.setHorizontalGroup(
			gl_SistemaBackup.createParallelGroup(Alignment.LEADING)
				.addGroup(Alignment.TRAILING, gl_SistemaBackup.createSequentialGroup()
					.addContainerGap()
					.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 346, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addGroup(gl_SistemaBackup.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_SistemaBackup.createSequentialGroup()
							.addGap(350)
							.addComponent(separator, GroupLayout.PREFERRED_SIZE, 1, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_SistemaBackup.createParallelGroup(Alignment.TRAILING, false)
							.addComponent(btnNewButton, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
							.addComponent(btnRestaurar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
					.addContainerGap())
		);
		gl_SistemaBackup.setVerticalGroup(
			gl_SistemaBackup.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_SistemaBackup.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_SistemaBackup.createParallelGroup(Alignment.LEADING)
						.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE)
						.addGroup(gl_SistemaBackup.createSequentialGroup()
							.addGap(199)
							.addComponent(separator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_SistemaBackup.createSequentialGroup()
							.addComponent(btnNewButton)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(btnRestaurar)))
					.addContainerGap(49, Short.MAX_VALUE))
		);
		
		JEditorPane dtrpnSistemaDeBackup = new JEditorPane();
		scrollPane.setViewportView(dtrpnSistemaDeBackup);
		dtrpnSistemaDeBackup.setText("SISTEMA DE BACKUP\r\n\r\nArea destinada para exportar base de dados desenvolvidas em todas as aplica\u00E7\u00F5es do sistema.\r\n\r\nRecomenda-se que uma pessoa especializada em banco de dados manuzeie esta area.\r\n\r\nAo clicar o bot\u00E3o \"BACKUP\" o sistema solicitar\u00E1 um caminho em que ser\u00E1 armazenado a base de dados.\r\n\r\nDeve-se salvar o arquivo em extens\u00E3o arquivo.sql.");
		SistemaBackup.setLayout(gl_SistemaBackup);

	}
}